package com.briup.server.config;

import com.briup.common.config.SpringWebConfig;
import com.briup.server.web.interceptor.AuthInterceptor;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

/**
 * SpringMVC的配置类
 */
@Configuration
@RequiredArgsConstructor
public class SpringMvcConfig extends SpringWebConfig {

    private final AuthInterceptor authInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/auth/login",
                        "/auth/sendCode",
                        "/auth/loginByCode",
                        "/captcha/**",
                        "/profile/**",
                        "/common/download**",
                        "/common/download/resource**",
                        "/swagger-ui.html",
                        "/swagger-resources/**",
                        "/webjars/**",
                        "/*/api-docs/**",
                        "/druid/**",
                        "/favicon.ico",
                        "/doc.html");
    }
}
